package cn.backpackerxl.server.impl;
import cn.backpackerxl.model.Admin;
import cn.backpackerxl.server.AdminService;
import cn.backpackerxl.repo.AdminDao;
import cn.backpackerxl.easyJDBC.main.EasyJDBCRepository;

import java.util.List;
/**
 * @Author: backpackerxl
 * CreateTime: 2022/11/24
 * FileName: AdminServiceImpl
 **/
public class AdminServiceImpl implements AdminService {
	private final AdminDao admindao = (AdminDao) new EasyJDBCRepository(AdminDao.class).init();

	@Override
	public int add(Admin admin) {
		return admindao.save(admin);
	}

	@Override
	public int edit(Admin admin) {
		return admindao.update(admin);
	}

	@Override
	public int delete(Long id) {
		return admindao.remove(id);
	}

	@Override
	public Admin selectById(Long id) {
		return admindao.findById(id);
	}

	@Override
	public List<Admin> selectAll() {
		return admindao.findAll();
	}

}